﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbSpatialFilter : OdDbFilter
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbSpatialFilter(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbSpatialFilter_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbSpatialFilter obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbSpatialFilter()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbSpatialFilter(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbSpatialFilter cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbSpatialFilter_cast(OdRxObject.getCPtr(pObj));
			OdDbSpatialFilter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSpatialFilter_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSpatialFilter_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSpatialFilter_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbSpatialFilter createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbSpatialFilter_createObject();
			OdDbSpatialFilter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbSpatialFilter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass indexClass()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSpatialFilter_indexClass(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void queryBounds(OdGeExtents3d ext)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_queryBounds(this.swigCPtr, OdGeExtents3d.getCPtr(ext));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getVolume(OdGePoint3d fromPoint, OdGePoint3d toPoint, OdGeVector3d upDir, OdGeVector2d viewField)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_getVolume(this.swigCPtr, OdGePoint3d.getCPtr(fromPoint), OdGePoint3d.getCPtr(toPoint), OdGeVector3d.getCPtr(upDir), OdGeVector2d.getCPtr(viewField).Handle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeVector3d normal, double elevation, double frontClip, double backClip, bool enabled)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_0(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal), elevation, frontClip, backClip, enabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeVector3d normal, double elevation, double frontClip, double backClip)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_1(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal), elevation, frontClip, backClip);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeVector3d normal, double elevation, double frontClip)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_2(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal), elevation, frontClip);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeVector3d normal, double elevation)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_3(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal), elevation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeVector3d normal)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_4(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_5(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeMatrix3d xToClipSpace, double frontClip, double backClip, bool enabled)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_6(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeMatrix3d.getCPtr(xToClipSpace), frontClip, backClip, enabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeMatrix3d xToClipSpace, double frontClip, double backClip)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_7(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeMatrix3d.getCPtr(xToClipSpace), frontClip, backClip);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeMatrix3d xToClipSpace, double frontClip)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_8(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeMatrix3d.getCPtr(xToClipSpace), frontClip);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGePoint2dArray points, OdGeMatrix3d xToClipSpace)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_9(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeMatrix3d.getCPtr(xToClipSpace));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getDefinition(OdGePoint2dArray points, OdGeVector3d normal, out double elevation, out double frontClip, out double backClip, out bool enabled)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_getDefinition__SWIG_0(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, OdGeVector3d.getCPtr(normal), out elevation, out frontClip, out backClip, out enabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGiClipBoundary clipBoundary, bool enabled)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_10(this.swigCPtr, OdGiClipBoundary.getCPtr(clipBoundary), enabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDefinition(OdGiClipBoundary clipBoundary)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setDefinition__SWIG_11(this.swigCPtr, OdGiClipBoundary.getCPtr(clipBoundary));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getDefinition(OdGiClipBoundary clipBoundary, out bool enabled, bool plotting)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_getDefinition__SWIG_1(this.swigCPtr, OdGiClipBoundary.getCPtr(clipBoundary), out enabled, plotting);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getDefinition(OdGiClipBoundary clipBoundary, out bool enabled)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_getDefinition__SWIG_2(this.swigCPtr, OdGiClipBoundary.getCPtr(clipBoundary), out enabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d getClipSpaceToWCSMatrix(OdGeMatrix3d mat)
		{
			OdGeMatrix3d result = new OdGeMatrix3d(TD_DbPINVOKE.OdDbSpatialFilter_getClipSpaceToWCSMatrix(this.swigCPtr, OdGeMatrix3d.getCPtr(mat)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeMatrix3d getOriginalInverseBlockXform(OdGeMatrix3d mat)
		{
			OdGeMatrix3d result = new OdGeMatrix3d(TD_DbPINVOKE.OdDbSpatialFilter_getOriginalInverseBlockXform(this.swigCPtr, OdGeMatrix3d.getCPtr(mat)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void boundary(OdGePoint2dArray points)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_boundary(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeVector3d normal()
		{
			OdGeVector3d result = new OdGeVector3d(TD_DbPINVOKE.OdDbSpatialFilter_normal(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d origin()
		{
			OdGePoint3d result = new OdGePoint3d(TD_DbPINVOKE.OdDbSpatialFilter_origin(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool frontClipEnabled()
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_frontClipEnabled(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double frontClipDist()
		{
			double result = TD_DbPINVOKE.OdDbSpatialFilter_frontClipDist(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool backClipDistEnabled()
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_backClipDistEnabled(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double backClipDist()
		{
			double result = TD_DbPINVOKE.OdDbSpatialFilter_backClipDist(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEnabled()
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_isEnabled(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setPerspectiveCamera(OdGePoint3d fromPoint)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setPerspectiveCamera(this.swigCPtr, OdGePoint3d.getCPtr(fromPoint));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool clipVolumeIntersectsExtents(OdGeExtents3d extents)
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_clipVolumeIntersectsExtents(this.swigCPtr, OdGeExtents3d.getCPtr(extents));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool hasPerspectiveCamera()
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_hasPerspectiveCamera(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSpatialFilter_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSpatialFilter_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isFilterInverted()
		{
			bool result = TD_DbPINVOKE.OdDbSpatialFilter_isFilterInverted(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFilterInverted(bool bSet)
		{
			TD_DbPINVOKE.OdDbSpatialFilter_setFilterInverted(this.swigCPtr, bSet);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdResult generateClipBoundaryFromPline(OdDbObjectId id)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSpatialFilter_generateClipBoundaryFromPline(this.swigCPtr, OdDbObjectId.getCPtr(id));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
